<template>
  <div>
    <!-- 信息区域 -->
    <div class="info">
      <el-form ref="ref" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="姓名：" prop="teacher_name">
          <el-input :disabled="true" v-model="form.teacher_name"></el-input>
        </el-form-item>
        <el-form-item label="账号：" prop="teacher_num">
          <el-input :disabled="true" v-model="form.teacher_num"></el-input>
        </el-form-item>
        <el-form-item label="职称：" prop="teacher_Workplace">
          <el-input
            :disabled="true"
            v-model="form.teacher_Workplace"
          ></el-input>
        </el-form-item>
        <el-form-item label="学院：" prop="teacher_college">
          <el-input :disabled="true" v-model="form.teacher_college"></el-input>
        </el-form-item>
        <el-form-item label="电话：" porp="teacher_phone">
          <el-input :disabled="true" v-model="form.teacher_phone"></el-input>
        </el-form-item>
        <el-form-item label="邮箱：" porp="teacher_email">
          <el-input :disabled="true" v-model="form.teacher_email"></el-input>
        </el-form-item>
        <!-- <el-form-item v-model="form.username" label="地址：">
          <el-input></el-input>
        </el-form-item> -->
        <el-button @click="update()">返回</el-button>
      </el-form>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  // 生命周期，创建完成后自动执行
  created () {
    this.getinfo();
  },
  data () {
    return {
      form: {},
      rules: {
        student_telephoneNum: [
          { min: 6, max: 13, message: "电话最小12位", trigger: "blur" },
        ],
      },
    };
  },
  methods: {
    // 发送获取个人信息的请求
    getinfo () {
      const n = window.location.hash.substring(25);
      //   console.log(n);
      axios
        .post("http://127.0.0.1:8080/minAdmin/get_teacher?id=" + n)
        .then((res) => {
          this.form = res.data.data[0];
          //   console.log(res);
        });
      // const name = document.querySelector("#name");
      // const namenum = document.querySelector("#namenum");
      // const college = document.querySelector("#college");
      // const tel = document.querySelector("#tel");
      // tel.value = res.data.data.student_telephoneNum;
      // name.value = res.data.data.student_name;
      // namenum.value = res.data.data.student_num;
      // college.value = res.data.data.student_college;
    },
    // 提交按钮的函数
    update () {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang="less" scoped>
.info {
  width: 300px;
}
</style>
